<?php

class Model_Agent extends Joob_Db_Table	{
	
	protected $key = "id";
	
	protected $db = "agents";
	
	public static function getAllAgents(){
		$agent = new Model_Agent();
		return $agent->search('','id,name,address,region,city,phone');
	}
	
	public function addNew()	{
		return $this->insert('name,address,region,city,phone');
	}
	
	public function getAgentDetail(){
		return array('id'=>$this->id, 'name'=>$this->name, 'address'=>$this->address,
				'region'=>$this->region, 'city'=>$this->city, 'phone'=>$this->phone
		);
	}
	
	public function updateAgent()	{
		return $this->edit('name, address, phone, city, region');
	}
}

?>